# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-pefile
pkgver=2024.8.26
pkgrel=0
pkgdesc="Python PE parsing module"
url="https://github.com/erocarrera/pefile"
arch="noarch"
license="MIT"
depends="py3-future python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/erocarrera/pefile/archive/v$pkgver.tar.gz"
builddir="$srcdir/pefile-$pkgver"
# tests need some intricate data unpacking..
options="!check"

replaces=py-pefile # Backwards compatibility
provides=py-pefile=$pkgver-r$pkgrel # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 run_tests.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
d81dc149da6dfc70e80c305440f2846a04904e8c442a42882b9c8d1a7a2b5ccf827be19827f4979e9880098a67dc858ddcce5a24b35cc6b7cda2e448f3e1386f  py3-pefile-2024.8.26.tar.gz
"
